{% extends "base.html" %}

{% block title %}| Pagina Principal{% endblock %}

{% block body %}

{% load diario_entries diario_comments %}

<div id="main">
  <center><h1>Novidades</h1></center>

  {% get_diario_entry_list 3 as latest_entries %}

  {% if latest_entries %}
    {% for entry in latest_entries %}
    <div>
      <div style="margin-left:50px"><h2><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></h2></div>
		<div style="margin-left:80px;background:#333; border-right:50px solid #111;">
		<div style="color:#999;"> <i><p>{{ entry.pub_date|date:"F j, Y" }}</p></div></i>
		{% autoescape off %}
      {{ entry.body|truncatewords:30}}<br/><br/>
    	{% endautoescape %}
		<a href="{{entry.get_absolute_url}}">Leia mais</a>
		</div>
    </div>
    {% endfor %}
  {% endif %}

   <div style="margin-left:50px"><a href="/blog/"> Noticias Anteriores </a></div >

</div>

<br/>

<center>
	<table width=800>
		<tr><td align="left">
					<table>
						<tr><th colspan=4 align="center"> <h1>Ultimas platinas</h1> </th></tr>
						<tr align="center"><th width=100> Usuario </th> <th> Jogo </th> <th> Trofeu </th> <th> Data </th></tr>
						{% for user in user_platinum_db %}
							<tr><td> 
                        <img class="meio" src="{{ user.user.pic_url}}" height=20 />
                        <a href= "/rank/{{ user.user.auth.username }}"> {{ user.user.auth.username}} </a>
							</td>
								 <td> 
								<a href="/game/{{user.trophy.game.psn_id}}"> <img class="meio" src="/media/game/{{ user.trophy.game.psn_id }}/icon.png" width=160 height=88/> </a>
								 </td>
	 							 <td>
			<a href="/game/{{user.trophy.game.psn_id}}/{{user.trophy.total_id}}">
	<img src="/media/game/{{ user.trophy.game.psn_id }}/{{ user.trophy.pic_url }}" height=54>
			</a>
</td>
								 <td width=50 align="center"> {{ user.date|date:"d-m-y H:i:s" }} </td></tr>
						{% endfor %}
					</table>
					</td>
					<td align="right">
				
					<table>
						<tr><th colspan=4 align="center"> <h1>Ultimos trofeus</h1> </th></tr>
						<tr align="center"><th width=100> Usuario </th> <th> Jogo </th> <th> Trofeu </th> <th> Data </th></tr>
						{% for user in user_trophy_db %}
							<tr><td align="left"> 
                        <img class="meio" src="{{ user.user.pic_url}}" height=20 />
                        <a href= "/rank/{{ user.user.auth.username }}"> {{ user.user.auth.username}} </a>
							</td>
								 <td border=0> 
								<a href="/game/{{user.trophy.game.psn_id}}"> <img class="meio" src="/media/game/{{ user.trophy.game.psn_id }}/icon.png" width=160 height=88/> </a>
								 </td>
		<td> 
			<a href="/game/{{user.trophy.game.psn_id}}/{{user.trophy.total_id}}">
		{% ifequal user.trophy.pic_url "0" %}
			<img class="meio" src="/media/hidden-lock.png" height=44 width=50 />
		{% else %}
			{% ifequal user.trophy.pic_url 'hidden.png' %}
				<img class="meio" src="/media/hidden-lock.png" width=54 height=54/>
			{% else %}
				<img class="meio" src="/media/game/{{user.trophy.game.psn_id}}/{{ user.trophy.pic_url}}" height=44 width=50 />
			{% endifequal %}
			</a>
		{% endifequal %}
		</td>
								 <td width=50 align="center"> {{ user.date|date:"d-m-y H:i:s" }} </td></tr>
						{% endfor %}
					</td></tr>
					</table>
		</td></tr>
	</table>
</center>
			
{% endblock %}
